package com.darknight.ftp.component.service;

import com.darknight.ftp.connection.FtpUserConnection;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by DarKnight on 2017/5/24.
 */
public interface UploadFileService {
    FtpUserConnection getConnection(String ftpHostName, Integer ftpPort) throws IOException;

    FtpUserConnection getConnectedConnection(String ftpHostName, Integer ftpPort) throws IOException;

    void returnConnection(FtpUserConnection connection);

    boolean loginFtpServer(String account, String password, FtpUserConnection connection) throws IOException;

    boolean logout(FtpUserConnection connection) throws IOException;

    boolean reachStoreFilePath(String storeFilePath, FtpUserConnection connection) throws IOException;

    boolean storeFile(String storeFileName, InputStream inputStream, FtpUserConnection connection) throws IOException;

    void uploadFile(String ftpHostName, Integer ftpPort, String account, String password,
                    String storeFileName, InputStream inputStream, String storeFilePath);

    boolean uploadFile(String account, String password, MultipartFile uploadFile, String storeFilePath);
}
